{include file="public/header" /}
<link rel="stylesheet" type="text/css" href="/static/admin/webupload/webuploader.css">
<link rel="stylesheet" type="text/css" href="/static/admin/webupload/style.css">
<style>
    .file-item{float: left; position: relative; width: 110px;height: 110px; margin: 0 20px 20px 0; padding: 4px;}
    .file-item .info{overflow: hidden;}
    .uploader-list{width: 100%; overflow: hidden;}
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加管理员</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal" name="add" id="add" method="post" action="{:url('add')}">

                        <div class="form-group">
                            <label class="col-sm-3 control-label">模板类型：</label>
                            <div class="input-group col-sm-4">
                                <select name = 'temp' id="temp" class="form-control"  onchange="changetemp()" >

                                    {if condition="$data.role='teach'"}
                                    <option value="作业提醒" >作业提醒</option>
                                    <option value="班级通知" >班级通知</option>
                                    {/if}


                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>


                        <div class="form-group">
                            <label class="col-sm-3 control-label" id="f1">招呼语句：</label>
                            <div class="input-group col-sm-4">
                                <input id="first" type="text" class="form-control" name="first" >
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>


                        <div class="form-group">
                            <label class="col-sm-3 control-label" id="k1">时间：</label>
                            <div class="input-group col-sm-4">
                                <input id="keyword1" type="text" class="form-control" name="keyword1"  >
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>


                        <div class="form-group">
                            <label class="col-sm-3 control-label" id="k2">科目：</label>
                            <div class="input-group col-sm-4">
                                <input id="keyword2" type="text" class="form-control" name="keyword2"  >
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label" id="k3">作业简介：</label>
                            <div class="input-group col-sm-4">
                                <input id="keyword3" type="text" class="form-control" name="keyword3"  >
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>


                        <div class="form-group">
                            <label class="col-sm-3 control-label" id="k4">作业详情：</label>
                            <div class="input-group col-sm-4">
                                <textarea id="keyword4" name="keyword4" class="form-control" rows="5" ></textarea>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>


                        <div class="form-group">
                            <label class="col-sm-3 control-label" id="r1">备注：</label>
                            <div class="input-group col-sm-4">
                                <textarea id="remark" name="remark" class="form-control" rows="5" ></textarea>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>


                        <div class="form-group" style="display: none;">
                            <label class="col-sm-3 control-label">是否有点击查看：</label>
                            <div class="input-group col-sm-4">
                                <select name ='is_url'  class="form-control" id="is_url">
                                    <option value="0">不允许</option>
                                    <option value="1">允许</option>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>


                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">

                                {if condition="$data.role='teach'"}
                                <input type="hidden" name="class_id" value="{$data['class_id']}"  >
                                {/if}


                                <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;&nbsp;
                                <a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>

        </div>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript">
    //提交
    $(function(){
        $('#add').ajaxForm({
            beforeSubmit: checkForm,
            success: complete,
            dataType: 'json'
        });

        function checkForm(){

        }

        function complete(data){
            if(data.code==1){
                layer.msg(data.msg, {icon: 6,time:1500,shade: 0.1}, function(index){
                    window.location.href="{:url('temp/index')}";
                });
            }else{
                layer.msg(data.msg, {icon: 5,time:1500,shade: 0.1});
                return false;
            }
        }

    });


    function changetemp(){
        var cc = $('#temp').val();
        if(cc=='班级通知'){
              //  $('#f1').val('');
                $('#k1').html('所在班级');
                $('#k2').html('通知老师');
                $('#k3').html('通知时间');
                $('#k4').html('通知内容');
            //    $('#r1').val('通知内容');
        }

        if(cc=='作业提醒'){
            $('#k1').html('时间');
            $('#k2').html('科目');
            $('#k3').html('作业简介');
            $('#k4').html('作业详情');
        }
    }



</script>
</body>
</html>